/*
 * Copyright (c) 2018 maoyan.com
 * All rights reserved.
 *
 */
package com.darren.euc.service.impl;

import com.darren.euc.dao.ServiceTelDao;
import com.darren.euc.entity.ServiceTel;
import com.darren.euc.service.ServiceTelService;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 在这里编写类的功能描述
 *
 * @author fangwenhao
 * @created 2018/3/11
 */
@Service
public class ServiceTelServiceImpl implements ServiceTelService {

    @Autowired
    private ServiceTelDao serviceTelDao;

    @Override
    public ServiceTel findById(Long id) {
        return serviceTelDao.findById(id);
    }

    @Override
    public ServiceTel update(JSONObject data) {
        String wechat = data.getString("wechat");
        String tel = data.getString("tel");
        Long id = data.getLong("id");
        ServiceTel serviceTel = serviceTelDao.findById(id);
        serviceTel.setWechat(wechat);
        serviceTel.setTel(tel);
        serviceTel.setModTime(new Date());
        return serviceTelDao.update(serviceTel);
    }

}
